<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>修改用户数据</h1>
<% 
    request.setCharacterEncoding("utf-8");
    String userid = request.getParameter("id"); 
    String name = "",phone = "",roomType = "",indate = "",outdate = "",amount = "",price = "",room_number = "";
    javax.sql.rowset.WebRowSet rs = aa.db.DBTools.getRS("SELECT * FROM 成都梦之旅文君楼庭院酒店（宽窄巷子店） WHERE userid='" + userid + "'");
        while(rs.next()){ 
        
            name = rs.getString("name");
            phone = rs.getString("phone");
            roomType = rs.getString("roomType");
            indate= rs.getString("indate");
            outdate = rs.getString("outdate");
            amount = rs.getString("amount");
            price= rs.getString("price");
            room_number = rs.getString("room_number");
        }
    
                rs.close();
%>
<form action="save1.jsp" method="post">
    <label for="userid">userid:</label>
    <input type="text" id="userid" name="userid" value="<%=userid%>"><br>
    <label for="name">name:</label>
    <input type="text" id="name" name="name" value="<%=name%>"><br>
    <label for="phone">phone:</label>
    <input type="text" id="phone" name="phone" value="<%=phone%>"><br>
      <label for="roomType">roomType:</label>   
    <select id="roomType" name="roomType">  
        <option value="单人间" <%= (roomType == "1") ? "selected" : "" %>>单人间</option>  
        <option value="双人间" <%= (roomType == "1") ? "selected" : "" %>>双人间</option>  
        <option value="大床房" <%= (roomType == "3") ? "selected" : "" %>>大床房</option>  
        <option value="钟点房" <%= (roomType == "4") ? "selected" : "" %>>钟点房</option>  
    </select>   
    <br>  
    <label for="indate">indate:</label>
    <input type="datetime-local" id="indate" name="indate" value="<%=indate%>"><br>
    <label for="outdate">outdate:</label>
    <input type="datetime-local" id="outdate" name="outdate" value="<%=outdate%>"><br>
     <label for="amount">amount:</label>
    <input type="text" id="amount" name="amount" value="<%=amount%>"><br>
     <label for="price">price:</label>
    <input type="text" id="price" name="price" value="<%=price%>"><br> 
    <label for="room_number">room_number:</label>
    <input type="text" id="room_number" name="room_number" value="<%=room_number%>"><br>

    <input type="submit" name="btn" value="修改"><br>
    <input type="submit" name="btn" value="新增"><br>
</form>
</body>
</html>